Analog comparator

Short description

The output is set and reset depending on the difference Ax – Ay and on two configurable thresholds.

Connection

Description

Inputs Ax, Ay

Inputs Ax, Ay are two analog signals from the followings:

  • AI1 to AI8 (*)

  • AM1 to AM6 (if 0BA6) or AM1 to AM16 (if 0BA7)

  • AN1 to AN32 (if 0BA7)

  • AQ1 and AQ2

  • SAQ1 to SAQ16 (if 0BA7)

  • The block number of a function with analog output

Parameter

A: Gain

Range of values: +- 10.00

B: Zero offset
Range of values: +- 10,000

On: On threshold
Range of values: +- 20,000

Off: Off threshold
Range of values: +- 20,000

p: Number of decimals
Range of values: 0, 1, 2, 3

Output Q

Q is set or reset depending on the set thresholds.

* AI1 to AI8: 0 to 10 V corresponds with 0 to 1000 (internal value).

0BA4:

A: Gain

Range of values: 0.00 to 10.00

0BA0-0BA3:
The following parameters apply:

G : Gain in [%]
Range of values: 0 to 1000 %

O : Offset
Range of values: ±999

delta : Threshold

Q is set to 1 when the difference Ax-Ay exceeds the threshold.

Parameters On and Off

The on threshold On and the off threshold Off can be provided by the actual value of another already-programmed function:

For the 0BA7 devices, you can additionally use the actual values of the following already-programmed functions:

You select the required function by the block number.

Parameter p (number of decimals)

Parameter p applies only to Ax, Ay, Delta, On and Off values displayed in a message text.

Parameter p does not apply to the comparison of on and off values. (The compare function ignores the decimal point.)

Timing diagram

Description of the function

The function reads the value of the signal at the analog input Ax.

This value is multiplied by the value of parameter A (gain). Parameter B (offset) is added to the product, hence

(Ax * gain) + offset = Actual value Ax.

(Ay * gain) + offset = Actual value Ay.

Output Q is set or reset depending on the difference of the actual values Ax – Ay and the set thresholds. See the following calculation rule.

Calculation rule

0BA2, 0BA3:

The following functions/calculation rules apply:

The function adds the relevant specified offset to the analog values Ax and Ay. The sum is multiplied with the value of the gain parameter. The difference is formed from both calculated values.

Output Q is set if this difference between these values exceeds the threshold you have configured under delta.

Calculation rule:
Q = 1, if:
((Ax + offset) * gain) - ((Ay + offset)*gain)>threshold delta
Q is reset to 0 when the threshold reaches or drops below delta.

Reducing the input sensitivity of the analog comparator

You can delay the output of the analog comparator selectively by means of the "on delay" and "off delay" SFBs. By doing so, you determine that output Q is only set if the input trigger length Trg (= output of the analog comparator) exceeds the defined on delay time.

This way you can set a virtual hysteresis, which renders the input less sensitive to short changes.

Particular characteristics to be noted when configuring

For help on analog block parameters, refer to the Analog value processing section.

Special Functions Overview